fix: prevent invalid SQL when creating publication with no publish operations#1068
Open
selenaalpha77-sketch wants to merge 1 commit intosupabase:masterfrom
Open
Conversation
…erations When all publish_* flags are false (the default), the CREATE PUBLICATION statement was generating `WITH (publish = '')` which PostgreSQL rejects as invalid — the publish list must be non-empty. Fix: omit the WITH clause entirely when no publish operations are specified. PostgreSQL then uses its default (all operations: insert, update, delete, truncate), which is the sensible fallback. Also add a regression test covering this case. Fixes supabase/supabase#45020 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
create()is called with all publish flags set tofalse(their default), the generated SQL is:PostgreSQL rejects
WITH (publish = '')because the publish list must be non-empty. This causes a runtime database error.Reported in: supabase/supabase#45020
Fix
Omit the
WITH (publish = ...)clause entirely when no publish operations are specified. PostgreSQL then uses its default behavior: publish all operations (insert, update, delete, truncate).Test
Added a regression test:
create with no publish operations uses PostgreSQL defaultsthat verifies:true(PostgreSQL's default)🤖 Generated with Claude Code